<?php if(!$this->autos or !count($this->autos)):?>
	<div class="result-output-one-result" style="text-align:center;">
		<h3 style="line-height:317px;">Не найдено ни одного элемента</h3>
	</div>
<?php else: ?>
<?php foreach ($this->autos as $auto):?>

<div id="ad_<?= $auto['id']; ?>" class="r">
    <div class="r_t" style='margin-bottom:100px;'>
		<a href="<?= $this->url_Auto($auto['id'], $auto['mark']['name'], $auto['model']['name']) ?>" class="auto-url-<?= $auto['id']; ?> b_link">
                    <?php if($auto['mainPhotoUrl']):?>
                            <img alt="car" class="auto-photo-<?= $auto['id']; ?> has-photo" width="128" height="96" src="<?= $this->getImage($auto['mainPhotoUrl'],'s')?>" />
                    <?php else: ?>
                            <img alt="car" class="auto-photo-<?= $auto['id']; ?> has-no-photo"  width="128" height="96" src="images/nophoto/<?= $auto['categoryId']?>l.jpg" />
                    <?php endif;?>
                    <? if($auto['photos_count']>0): ?>
                        <span class="b_number_photos"><?=$auto['photos_count']; ?> фото</span>
                    <? endif; ?>
        </a>
	</div>
	<h2>
		<a href="<?= $this->url_Auto($auto['id'], $auto['mark']['name'], $auto['model']['name']) ?>" class="auto-title-<?= $auto['id']; ?>">
                    <?= $auto['mark']['name']." ".$auto['model']['name']." ".$auto['years']?>
                </a>
            <?php if($auto['isUnderCredit'] || $auto['isDamaged']) :?>
                <br />
                <?php if($auto['isUnderCredit']):?><img alt="Авто в кредите" src="images/credit.png" /><?php endif; ?>
                <?php if($auto['isDamaged']):?><img alt="После ДТП" src="images/after-road-accident.png" /><?php endif; ?>
            <?php endif; ?>
    </h2>
	<p>
		<strong class="auto-area-<?= $auto['id']; ?>"><?= $auto['city']['name']?></strong>
        <span class="r_pub">Объявление добавлено <?= $auto['addDate']->format('Y-m-d') ?></span><br />
		<span class="r_text"  style="clear:both;">
            <?php if(mb_strlen($auto['description'], 'utf8')  > 80 ):?>
                    <?php $text = $this->truncate($auto['description'], 80, ''); ?>
                    <span class="j-short-description"><?= $text; ?></span>
                    <span class="j-full-description hidden"><?= str_replace($text, '', $auto['description']); ?></span>
                    <span><a href="content.phtml#" class="j-toggle-content-show">Раскрыть</a></span>
                    <span><a href="content.phtml#" class="hidden j-toggle-content-hide">Свернуть</a></span>
            <?php else :?>
                <?= $auto['description']?>
            <?php endif;?>
            <br />
            <?/*php foreach ($auto['user']['phones'] as $phone):?>
				<strong style="margin-right:10px;"><?= $phone['phoneFormatted'];?></strong>
			<?php endforeach;*/?>
        </span>
	</p>
	<div class="r_y">
            <span <? if('years'==$this->sort_info['order_field']): ?> style="background-color: #feff6b;font-size:larger;" <? endif;?>>
                <?= $auto['years']?>
            </span>
        </div>

	<div class="r_m">
            <span <? if('mileage'==$this->sort_info['order_field']): ?> style="background-color: #feff6b;font-size:larger;" <? endif;?>>
                <?= $auto['mileage'] ? $auto['mileage']." "._('тыс.км.') : _('без пробега')?>
            </span>
        </div>

	<div class="r_p"><span class="auto-price-<?= $auto['id']; ?>" <? if('price'==$this->sort_info['order_field']): ?> style="background-color: #feff6b;font-size:larger;" <? endif;?>>
                             <?php if($auto['price']):?>
                            <?= $this->formatCurrency($auto['price'], $auto['currency']['id'])?>
                    <?php else:?>
                            <?= _('Дог.')?>
                    <?php endif;?></span></div>

		<ul>
			<li class="r_comp">
				<label for="to_comparison_<?= $auto['id']; ?>">
                    <input type="checkbox" id="to_comparison_<?= $auto['id']; ?>" />
                    <span class="r_comp_span"></span>
                    <i>Блокнот</i></label>
                </label>
			</li>
			<?php /* <li class="r_to_list">
				<a rel="nofollow" href="#">Сохранить в блокнот</a>
			</li> */ ?>
			<?php /* <li class="r_photo">x 3</li> */ ?>
		</ul>
</div>

<?php  endforeach; ?>
<?php $this->headScript()->appendFile('js/plugins/plugin.imageLoader.js'); ?>
<?php $this->headScript()->appendScript('$("a img.has-photo").imageLoader()'); ?>
<?php endif; ?>